home *** CD-ROM | disk | FTP | other *** search
/ Languguage OS 2 / Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO / gnu / dejagnu.lha / dejagnu-1.0.1 / test-build.mk < prev   
Makefile  |  1993-04-26  |  16KB  |  563 lines

  1. ###
  2. ### Makefile used to three-stage build a tree of source code.  Also used to
  3. ### compile other bundles, first with cc, then with gcc.
  4. ###
  5.  
  6. ###
  7. ### USE OF THIS FILE REQUIRES GNU MAKE!!!
  8. ###
  9.  
  10. ### The first versions of the file were written by Rich Pixley (rich@cygnus.com).
  11. ### Many subsequent additions (and current maintainance by) david d `zoo' zuhn,
  12. ### (zoo@cygnus.com).
  13.  
  14. ### Every invocation of this Makefile needs to have a variable set (host), 
  15. ### which is the named used for ./configure, and also the prefix for the
  16. ### various files and directories used in a three stage.
  17.  
  18. ifndef host
  19. error:
  20.     @echo You must set the variable \"host\" to use this Makefile ; exit 1
  21. else
  22.  
  23. ### from here to very near the end of the file is the real guts of this 
  24. ### Makefile, and it is not seen if the variable 'host' is not set 
  25.  
  26. ###
  27. ### START EDITTING HERE!!!
  28. ### These things will need to be set differently for each release.
  29. ###
  30.  
  31. ### from which cvs tree are we working?
  32. TREE := devo
  33.  
  34. ### binaries should be installed into?
  35. ROOTING := /usr/cygnus
  36.  
  37. ### When working from a tagged set of source, this should be the tag.  If not,
  38. ### then set the macro to be empty.
  39. CVS_TAG := 
  40.  
  41. ### The name of the cvs module for this release.  The intersection of
  42. ### CVS_MODULE and CVS_TAG defines the source files in this release.
  43. CVS_MODULE := latest
  44.  
  45. ### Historically, this was identical to CVS_TAG.  This is changing.
  46. RELEASE_TAG := latest-930426
  47.  
  48. ### Historically, binaries were installed here.  This is changing.
  49. release_root := $(ROOTING)/$(RELEASE_TAG)
  50.  
  51. ### STOP EDITTING HERE!!!
  52. ### With luck, eventually, nothing else will need to be editted.
  53.  
  54. TIME         := time
  55. GCC         := gcc -O
  56. GNUC        := CC="$(GCC)"
  57. CFLAGS        := -g
  58. GNU_MAKE     := /usr/latest/bin/make -w 
  59.  
  60. override MAKE         := make
  61. override MFLAGS     :=
  62. #override MAKEFLAGS     :=
  63.  
  64. SHELL := /bin/sh
  65.  
  66. FLAGS_TO_PASS := \
  67.     "GCC=$(GCC)" \
  68.     "CFLAGS=$(CFLAGS)" \
  69.     "TIME=$(TIME)" \
  70.     "MF=$(MF)" \
  71.     "host=$(host)" \
  72.     "RELEASE_TAG=$(RELEASE_TAG)"
  73.  
  74. ifneq  '$(CC)' 'cc'
  75. FLAGS_TO_PASS := "CC=$(CC)" $(FLAGS_TO_PASS)
  76. endif
  77.  
  78.  
  79. prefixes    = --prefix=$(release_root) --exec-prefix=$(release_root)/H-$(host)
  80. relbindir    = $(release_root)/H-$(host)/bin
  81.  
  82. ### general config stuff
  83. WORKING_DIR     := $(host)-objdir
  84. STAGE1DIR     := $(WORKING_DIR).1
  85. STAGE2DIR     := $(WORKING_DIR).2
  86. STAGE3DIR     := $(WORKING_DIR).3
  87. INPLACEDIR     := $(host)-in-place
  88. HOLESDIR     := $(host)-holes
  89.  
  90. SET_NATIVE_HOLES := SHELL=sh ; PATH=`pwd`/$(HOLESDIR) ; export PATH ; export SHELL ;
  91. SET_CYGNUS_PATH  := SHELL=sh ; PATH=$(relbindir):`pwd`/$(HOLESDIR) ; export PATH ; export SHELL ;
  92. SET_LATEST_PATH  := SHELL=sh ; PATH=/usr/latest/bin:`pwd`/$(HOLESDIR) ; export PATH ; export SHELL ;
  93.  
  94.  
  95.  
  96. .PHONY: all
  97. ifdef target
  98. ##
  99. ## This is a cross compilation
  100. ##
  101. arch         = $(host)-x-$(target)
  102. config      = -target=$(target)
  103. FLAGS_TO_PASS    := $(FLAGS_TO_PASS) "target=$(target)"
  104.  
  105. all:    do-native do-latest
  106. build-all: build-native build-latest
  107.  
  108. ifeq ($(target),mips-idt-ecoff)
  109. configargs    = -with-gnu-as
  110. else
  111. configargs    =
  112. endif
  113.  
  114. else
  115. ##
  116. ## This is a native compilation
  117. ##
  118. arch        = $(host)
  119. config      =
  120. all:    $(host)-stamp-3stage-done
  121. #all:    in-place do1 do2 do3 comparison
  122.  
  123. ifeq ($(subst mips-sgi-irix4,mips-dec-ultrix,$(host)),mips-dec-ultrix)
  124. configargs    = -with-gnu-as
  125. else
  126. configargs    =
  127. endif
  128.  
  129. endif
  130.  
  131. NATIVEDIR    := $(arch)-native-objdir
  132. CYGNUSDIR    := $(arch)-cygnus-objdir
  133. LATESTDIR    := $(arch)-latest-objdir
  134.  
  135.  
  136. everything:      do-cross 
  137. #everything:     in-place do1 do2 do3 comparison do-cygnus 
  138.  
  139. .PHONY: do-native
  140. do-native: $(host)-stamp-holes $(arch)-stamp-native
  141. do-native-config: $(arch)-stamp-native-configured
  142. build-native: $(host)-stamp-holes $(arch)-stamp-native-checked
  143. config-native: $(host)-stamp-holes $(arch)-stamp-native-configured
  144.  
  145. $(arch)-stamp-native: $(host)-stamp-holes
  146.     $(SET_NATIVE_HOLES) $(TIME) $(GNU_MAKE) -f test-build.mk  $(arch)-stamp-native-installed $(FLAGS_TO_PASS) 
  147.     if [ -f CLEAN_ALL ] ; then rm -rf $(NATIVEDIR) ; else true ; fi
  148.     touch $(arch)-stamp-native
  149.  
  150. $(arch)-stamp-native-installed: $(host)-stamp-holes $(arch)-stamp-native-checked
  151.     $(SET_NATIVE_HOLES) cd $(NATIVEDIR) ; $(TIME) $(MAKE) $(FLAGS_TO_PASS) install 
  152.     $(SET_NATIVE_HOLES) cd $(NATIVEDIR) ; $(TIME) $(MAKE) $(FLAGS_TO_PASS) install-info 
  153.     touch $@
  154.  
  155. $(arch)-stamp-native-checked: $(arch)-stamp-native-built
  156. #    cd $(NATIVEDIR) ; $(TIME) $(MAKE) $(FLAGS_TO_PASS) check 
  157.     touch $@
  158.  
  159. $(arch)-stamp-native-built: $(host)-stamp-holes $(arch)-stamp-native-configured
  160.     $(SET_NATIVE_HOLES) cd $(NATIVEDIR) ; $(TIME) $(MAKE) $(FLAGS_TO_PASS) all 
  161.     $(SET_NATIVE_HOLES) cd $(NATIVEDIR) ; $(TIME) $(MAKE) $(FLAGS_TO_PASS) info 
  162.     touch $@
  163.  
  164. $(arch)-stamp-native-configured: $(host)-stamp-holes
  165.     [ -d $(NATIVEDIR) ] || mkdir $(NATIVEDIR)
  166.     $(SET_NATIVE_HOLES) cd $(NATIVEDIR) ; $(TIME) ../$(TREE)/configure $(config) -v --srcdir=../$(TREE) $(prefixes) $(configargs)
  167.     touch $@
  168.  
  169.  
  170. .PHONY: do-cygnus
  171. do-cygnus: $(host)-stamp-holes $(arch)-stamp-cygnus
  172. build-cygnus: $(host)-stamp-holes $(arch)-stamp-cygnus-checked
  173. config-cygnus: $(host)-stamp-holes $(arch)-stamp-cygnus-configured
  174.  
  175. $(arch)-stamp-cygnus: 
  176.     [ -f $(relbindir)/gcc ] || (echo "must have gcc available"; exit 1)
  177.     $(SET_CYGNUS_PATH) $(TIME) $(GNU_MAKE) -f test-build.mk $(arch)-stamp-cygnus-installed  $(FLAGS_TO_PASS)
  178.     if [ -f CLEAN_ALL ] ; then rm -rf $(CYGNUSDIR) ; else true ; fi
  179.     touch $(arch)-stamp-cygnus
  180.  
  181. $(arch)-stamp-cygnus-installed:  $(host)-stamp-holes $(arch)-stamp-cygnus-checked
  182.     $(SET_CYGNUS_PATH) cd $(CYGNUSDIR) ; $(TIME) $(MAKE) $(FLAGS_TO_PASS) $(GNUC) install 
  183.     $(SET_CYGNUS_PATH) cd $(CYGNUSDIR) ; $(TIME) $(MAKE) $(FLAGS_TO_PASS) $(GNUC) install-info
  184.     touch $@
  185.  
  186. $(arch)-stamp-cygnus-checked: $(host)-stamp-holes $(arch)-stamp-cygnus-built
  187. #    cd $(CYGNUSDIR) ; $(TIME) $(MAKE) $(FLAGS_TO_PASS) $(GNUC) check 
  188.     touch $@
  189.  
  190. $(arch)-stamp-cygnus-built:  $(host)-stamp-holes $(arch)-stamp-cygnus-configured
  191.     $(SET_CYGNUS_PATH) cd $(CYGNUSDIR) ; $(TIME) $(MAKE) $(FLAGS_TO_PASS) $(GNUC) all 
  192.     $(SET_CYGNUS_PATH) cd $(CYGNUSDIR) ; $(TIME) $(MAKE) $(FLAGS_TO_PASS) $(GNUC) info 
  193.     touch $@
  194.  
  195. $(arch)-stamp-cygnus-configured:  $(host)-stamp-holes
  196.     [ -d $(CYGNUSDIR) ] || mkdir $(CYGNUSDIR)
  197.     $(SET_CYGNUS_PATH) cd $(CYGNUSDIR) ; $(GNUC) $(TIME) ../$(TREE)/configure $(config) -v --srcdir=../$(TREE) $(prefixes) $(configargs)
  198.     touch $@
  199.  
  200. .PHONY: do-latest
  201. do-latest: $(host)-stamp-holes $(arch)-stamp-latest
  202. build-latest: $(host)-stamp-holes $(arch)-stamp-latest-checked
  203.  
  204. $(arch)-stamp-latest:
  205.     $(SET_LATEST_PATH) $(TIME) $(GNU_MAKE) -f test-build.mk $(arch)-stamp-latest-installed  $(FLAGS_TO_PASS)
  206.     touch $(arch)-stamp-latest
  207.  
  208. $(arch)-stamp-latest-installed:  $(host)-stamp-holes $(arch)-stamp-latest-checked
  209.     $(SET_LATEST_PATH) cd $(LATESTDIR) ; $(TIME) $(MAKE) $(FLAGS_TO_PASS) $(GNUC) install 
  210.     $(SET_LATEST_PATH) cd $(LATESTDIR) ; $(TIME) $(MAKE) $(FLAGS_TO_PASS) $(GNUC) install-info 
  211.     touch $@
  212.  
  213. $(arch)-stamp-latest-checked: $(arch)-stamp-latest-built
  214. #    $(SET_LATEST_PATH) cd $(LATESTDIR) ; $(TIME) $(MAKE) $(FLAGS_TO_PASS) $(GNUC) check 
  215.     touch $@
  216.  
  217. $(arch)-stamp-latest-built: $(arch)-stamp-latest-configured
  218.     $(SET_LATEST_PATH) cd $(LATESTDIR) ; $(TIME) $(MAKE) $(FLAGS_TO_PASS) $(GNUC) all 
  219.     $(SET_LATEST_PATH) cd $(LATESTDIR) ; $(TIME) $(MAKE) $(FLAGS_TO_PASS) $(GNUC) info 
  220.     touch $@
  221.  
  222. $(arch)-stamp-latest-configured:
  223.     [ -d $(LATESTDIR) ] || mkdir $(LATESTDIR)
  224.     $(SET_LATEST_PATH) cd $(LATESTDIR) ; $(GNUC) $(TIME) ../$(TREE)/configure $(config) -v --srcdir=../$(TREE) $(prefixes) $(configargs)
  225.     touch $@
  226.  
  227.  
  228. .PHONY: in-place
  229. in-place:    $(host)-stamp-in-place
  230.  
  231. $(host)-stamp-in-place: 
  232.     PATH=/bin:/usr/bin:/usr/ucb ; \
  233.       export PATH ; \
  234.       SHELL=/bin/sh ; export SHELL ; \
  235.       $(TIME) $(GNU_MAKE) -f test-build.mk $(host)-stamp-in-place-installed host=$(host) $(FLAGS_TO_PASS)
  236.     touch $@
  237.     if [ -f CLEAN_ALL ] ; then \
  238.       rm -rf $(INPLACEDIR) ; \
  239.      else \
  240.       mv $(INPLACEDIR) $(STAGE1DIR) ; \
  241.     fi
  242.  
  243. $(host)-stamp-in-place-installed: $(host)-stamp-in-place-checked
  244.     cd $(INPLACEDIR) ; $(TIME) $(MAKE) $(FLAGS_TO_PASS) "CFLAGS=$(CFLAGS)" install host=$(host)
  245.     cd $(INPLACEDIR) ; $(TIME) $(MAKE) $(FLAGS_TO_PASS) "CFLAGS=$(CFLAGS)" install-info host=$(host)
  246.     touch $@
  247.  
  248. $(host)-stamp-in-place-checked: $(host)-stamp-in-place-built
  249. #    cd $(INPLACEDIR) ; $(TIME) $(MAKE) $(FLAGS_TO_PASS) "CFLAGS=$(CFLAGS)" check host=$(host)
  250.     touch $@
  251.  
  252. $(host)-stamp-in-place-built: $(host)-stamp-in-place-configured
  253.     cd $(INPLACEDIR) ; $(TIME) $(MAKE) $(FLAGS_TO_PASS) "CFLAGS=$(CFLAGS)" all host=$(host)
  254.     cd $(INPLACEDIR) ; $(TIME) $(MAKE) $(FLAGS_TO_PASS) "CFLAGS=$(CFLAGS)" info host=$(host)
  255.     touch $@
  256.  
  257. $(host)-stamp-in-place-configured: $(host)-stamp-in-place-cp
  258.     cd $(INPLACEDIR) ; $(TIME) ./configure $(config) -v $(prefixes) $(configargs)
  259.     touch $@
  260.  
  261. $(host)-stamp-in-place-cp:
  262.     rm -rf $(INPLACEDIR)
  263.     mkdir $(INPLACEDIR)
  264.     (cd $(TREE) ; tar cf - .) | (cd $(INPLACEDIR) ; tar xf -)
  265.     touch $@
  266.  
  267. $(host)-stamp-3stage-done: do1 do2 do3 comparison
  268.     touch $@
  269.  
  270.  
  271. .PHONY: do1
  272. do1:        $(host)-stamp-holes $(host)-stamp-stage1
  273. do1-config: $(host)-stamp-holes $(host)-stamp-stage1-configured
  274. do1-build:  $(host)-stamp-holes $(host)-stamp-stage1-checked
  275.  
  276. $(host)-stamp-stage1:
  277.     if [ -d $(STAGE1DIR) ] ; then \
  278.         mv $(STAGE1DIR) $(WORKING_DIR) ; \
  279.     else \
  280.         true ; \
  281.     fi
  282.     $(SET_NATIVE_HOLES) $(TIME) $(GNU_MAKE) -f test-build.mk $(FLAGS_TO_PASS) host=$(host) $(host)-stamp-stage1-installed
  283.     touch $@
  284.     if [ -f CLEAN_ALL ] ; then \
  285.       rm -rf $(WORKING_DIR) ; \
  286.     else \
  287.       mv $(WORKING_DIR) $(STAGE1DIR) ; \
  288.     fi
  289.  
  290. $(host)-stamp-stage1-installed: $(host)-stamp-stage1-checked
  291.     $(SET_NATIVE_HOLES) cd $(WORKING_DIR) ; $(TIME) $(MAKE) $(FLAGS_TO_PASS) "CFLAGS=$(CFLAGS)" install host=$(host)
  292.     $(SET_NATIVE_HOLES) cd $(WORKING_DIR) ; $(TIME) $(MAKE) $(FLAGS_TO_PASS) "CFLAGS=$(CFLAGS)" install-info host=$(host)
  293. ifeq ($(host),rs6000-ibm-aix)
  294.     -rm $(relbindir)/make
  295. endif
  296.     touch $@
  297.  
  298. $(host)-stamp-stage1-checked: $(host)-stamp-stage1-built
  299. #    $(SET_NATIVE_HOLES) cd $(WORKING_DIR) ; $(TIME) $(MAKE) $(FLAGS_TO_PASS) "CFLAGS=$(CFLAGS)" check host=$(host)
  300.     touch $@
  301.  
  302. $(host)-stamp-stage1-built: $(host)-stamp-stage1-configured
  303.     $(SET_NATIVE_HOLES) cd $(WORKING_DIR) ; $(TIME) $(MAKE) $(FLAGS_TO_PASS) "CFLAGS=$(CFLAGS)" all host=$(host)
  304.     $(SET_NATIVE_HOLES) cd $(WORKING_DIR) ; $(TIME) $(MAKE) $(FLAGS_TO_PASS) "CFLAGS=$(CFLAGS)" info host=$(host)
  305.     touch $@
  306.  
  307. $(host)-stamp-stage1-configured:
  308.     [ -d $(WORKING_DIR) ] || mkdir $(WORKING_DIR)
  309.     $(SET_NATIVE_HOLES) cd $(WORKING_DIR) ; \
  310.       $(TIME) ../$(TREE)/configure $(config) -v --srcdir=../$(TREE) $(prefixes) $(configargs)
  311.     touch $@
  312.  
  313. .PHONY: do2
  314. do2:    $(HOLESDIR) $(host)-stamp-stage2
  315.  
  316. $(host)-stamp-stage2:
  317.     if [ -d $(STAGE2DIR) ] ; then \
  318.         mv $(STAGE2DIR) $(WORKING_DIR) ; \
  319.     else \
  320.         true ; \
  321.     fi
  322.     $(SET_CYGNUS_PATH) $(TIME) $(GNU_MAKE) $(FLAGS_TO_PASS) -f test-build.mk -w $(host)-stamp-stage2-installed
  323.     mv $(WORKING_DIR) $(STAGE2DIR)
  324.     touch $@
  325.  
  326.  
  327. $(host)-stamp-stage2-installed: $(host)-stamp-stage2-checked
  328.     $(SET_CYGNUS_PATH) cd $(WORKING_DIR) ; $(TIME) $(MAKE) -w $(FLAGS_TO_PASS) $(GNUC) "CFLAGS=$(CFLAGS)" install host=$(host)
  329.     $(SET_CYGNUS_PATH) cd $(WORKING_DIR) ; $(TIME) $(MAKE) -w $(FLAGS_TO_PASS) $(GNUC) "CFLAGS=$(CFLAGS)" install-info host=$(host)
  330.     touch $@
  331.  
  332. $(host)-stamp-stage2-checked: $(host)-stamp-stage2-built
  333. #    $(SET_CYGNUS_PATH) cd $(WORKING_DIR) ; $(TIME) $(MAKE) -w $(FLAGS_TO_PASS) $(GNUC) "CFLAGS=$(CFLAGS)" check host=$(host)
  334.     touch $@
  335.  
  336. $(host)-stamp-stage2-built: $(host)-stamp-stage2-configured
  337.     $(SET_CYGNUS_PATH) cd $(WORKING_DIR) ; $(TIME) $(MAKE) -w $(FLAGS_TO_PASS) $(GNUC) "CFLAGS=$(CFLAGS)" all host=$(host)
  338.     $(SET_CYGNUS_PATH) cd $(WORKING_DIR) ; $(TIME) $(MAKE) -w $(FLAGS_TO_PASS) $(GNUC) "CFLAGS=$(CFLAGS)" info host=$(host)
  339.     touch $@
  340.  
  341. $(host)-stamp-stage2-configured:
  342.     [ -d $(WORKING_DIR) ] || mkdir $(WORKING_DIR)
  343.     $(SET_CYGNUS_PATH) cd $(WORKING_DIR) ; \
  344.       $(GNUC) $(TIME) ../$(TREE)/configure $(config) -v --srcdir=../$(TREE) $(prefixes) $(configargs)
  345.     touch $@
  346.  
  347. .PHONY: do3
  348. do3:    $(HOLESDIR) $(host)-stamp-stage3
  349.  
  350. $(host)-stamp-stage3:
  351.     if [ -d $(STAGE3DIR) ] ; then \
  352.         mv $(STAGE3DIR) $(WORKING_DIR) ; \
  353.     else \
  354.         true ; \
  355.     fi
  356.     $(SET_CYGNUS_PATH) $(TIME) $(GNU_MAKE) $(FLAGS_TO_PASS) -f test-build.mk -w $(host)-stamp-stage3-checked 
  357.     mv $(WORKING_DIR) $(STAGE3DIR) 
  358.     touch $@
  359.  
  360.  
  361. $(host)-stamp-stage3-installed: $(host)-stamp-stage3-checked
  362.     $(SET_CYGNUS_PATH) cd $(WORKING_DIR) ; $(TIME) $(MAKE) -w $(FLAGS_TO_PASS) $(GNUC) "CFLAGS=$(CFLAGS)" install host=$(host)
  363.     $(SET_CYGNUS_PATH) cd $(WORKING_DIR) ; $(TIME) $(MAKE) -w $(FLAGS_TO_PASS) $(GNUC) "CFLAGS=$(CFLAGS)" install-info host=$(host)
  364.     touch $@
  365.  
  366. $(host)-stamp-stage3-checked: $(host)-stamp-stage3-built
  367. #    $(SET_CYGNUS_PATH) cd $(WORKING_DIR) ; $(TIME) $(MAKE) -w $(FLAGS_TO_PASS) $(GNUC) "CFLAGS=$(CFLAGS)" check host=$(host)
  368.     touch $@
  369.  
  370. $(host)-stamp-stage3-built: $(host)-stamp-stage3-configured
  371.     $(SET_CYGNUS_PATH) cd $(WORKING_DIR) ; $(TIME) $(MAKE) -w $(FLAGS_TO_PASS) $(GNUC) "CFLAGS=$(CFLAGS)" all host=$(host)
  372.     $(SET_CYGNUS_PATH) cd $(WORKING_DIR) ; $(TIME) $(MAKE) -w $(FLAGS_TO_PASS) $(GNUC) "CFLAGS=$(CFLAGS)" info host=$(host)
  373.     touch $@
  374.  
  375. $(host)-stamp-stage3-configured:
  376.     [ -d $(WORKING_DIR) ] || mkdir $(WORKING_DIR)
  377.     $(SET_CYGNUS_PATH) cd $(WORKING_DIR) ; \
  378.       $(GNUC) $(TIME) ../$(TREE)/configure $(config) -v --srcdir=../$(TREE) $(prefixes) $(configargs)
  379.     touch $@
  380.  
  381. # These things are needed by a three-stage, but are not included locally.
  382.  
  383. HOLES := \
  384.     [ \
  385.     ar \
  386.     as \
  387.     awk \
  388.     basename \
  389.     cat \
  390.     cc \
  391.     chmod \
  392.     cmp \
  393.     cp \
  394.     cpio \
  395.     date \
  396.     diff \
  397.     echo \
  398.     egrep \
  399.     ex \
  400.     expr \
  401.     false \
  402.     find \
  403.     grep \
  404.     head \
  405.     hostname \
  406.     install \
  407.     ld \
  408.     lex \
  409.     ln \
  410.     ls \
  411.     make \
  412.     mkdir \
  413.     mv \
  414.     nm \
  415.     pwd \
  416.     ranlib \
  417.     rm \
  418.     rmdir \
  419.     sed \
  420.     sh \
  421.     sort \
  422.     tar \
  423.     test \
  424.     time \
  425.     touch \
  426.     tr \
  427.     true \
  428.     uname \
  429.     uudecode \
  430.     wc \
  431.     whoami
  432.  
  433. ### so far only sun make supports VPATH
  434. ifeq ($(subst sun3,sun4,$(host)),sun4)
  435. MAKE_HOLE :=
  436. else
  437. MAKE_HOLE := make
  438. endif
  439.  
  440. ### solaris 2 -- don't use /usr/ucb/cc
  441. ifeq (sparc-sun-solaris2,$(host))
  442. SET_NATIVE_HOLES := SHELL=sh ; PATH=/opt/SUNWspro/bin:`pwd`/$(HOLESDIR) ; export PATH ; export SHELL ;
  443. HOLE_DIRS := /usr/ccs/bin
  444. CC_HOLE :=
  445. NUKEM := cc 
  446. endif
  447.  
  448. ### These things are also needed by a three-stage, but in this case, the GNU version of the tool is required.
  449. PARTIAL_HOLES := \
  450.     $(MAKE_HOLE) \
  451.     $(CC_HOLE) \
  452.     flex \
  453.     m4
  454.  
  455. ### look in these directories for things missing from a three-stage
  456. HOLE_DIRS := \
  457.     $(HOLE_DIRS) \
  458.     /bin \
  459.     /usr/bin \
  460.     /usr/ucb \
  461.     /usr/unsupported/bin
  462.  
  463. ### look in these directories for alternate versions of some tools.
  464. PARTIAL_HOLE_DIRS := \
  465.     /usr/latest/bin \
  466.     /usr/progressive/bin \
  467.     $(PARTIAL_HOLE_DIRS) \
  468.     /usr/vintage/bin \
  469.     /usr/unsupported/bin
  470.  
  471. $(HOLESDIR): $(host)-stamp-holes
  472.  
  473. $(host)-stamp-holes:
  474.     -rm -rf $(HOLESDIR)
  475.     -mkdir $(HOLESDIR)
  476.     @for i in $(HOLES) ; do \
  477.         found= ; \
  478.         for j in $(HOLE_DIRS) ; do \
  479.             if [ -x $$j/$$i ] ; then \
  480.                 ln -s $$j/$$i $(HOLESDIR) || cp $$j/$$i $(HOLESDIR) ; \
  481.                 echo $$i from $$j ; \
  482.                 found=t ; \
  483.                 break ; \
  484.             fi ; \
  485.         done ; \
  486.         case "$$found" in \
  487.         t) ;; \
  488.         *) echo $$i is NOT found ;; \
  489.         esac ; \
  490.     done
  491.     @for i in $(PARTIAL_HOLES) ; do \
  492.         found= ; \
  493.         for j in $(PARTIAL_HOLE_DIRS) ; do \
  494.             if [ -x $$j/$$i ] ; then \
  495.                 rm -f $(HOLESDIR)/$$i ; \
  496.                 cp $$j/$$i $(HOLESDIR)/$$i || exit 1; \
  497.                 echo $$i from $$j ; \
  498.                 found=t ; \
  499.                 break ; \
  500.             fi ; \
  501.         done ; \
  502.         case "$$found" in \
  503.         t) ;; \
  504.         *) echo $$i is NOT found ;; \
  505.         esac ; \
  506.     done
  507. ifdef NUKEM
  508.     cd $(HOLESDIR); rm -f $(NUKEM)
  509. endif
  510.     touch $@
  511.  
  512. .PHONY: comparison
  513. comparison: $(host)-stamp-3stage-compared
  514.  
  515. $(host)-stamp-3stage-compared:
  516.     rm -f .bad-compare
  517. ifeq ($(subst i386-sco3.2v4,mips-sgi-irix4,$(subst rs6000-ibm-aix,mips-sgi-irix4,$(subst mips-dec-ultrix,mips-sgi-irix4,$(host)))),mips-sgi-irix4)
  518.     for i in `cd $(STAGE3DIR) ; find . -name \*.o -print` ; do \
  519.         tail +10c $(STAGE2DIR)/$$i > foo1 ; \
  520.         tail +10c $(STAGE3DIR)/$$i > foo2 ; \
  521.         if cmp foo1 foo2 ; then \
  522.             true ; \
  523.         else \
  524.             echo $$i ; \
  525.             touch .bad-compare ; \
  526.         fi ; \
  527.     done
  528.     rm -f foo1 foo2
  529. else
  530.     for i in `cd $(STAGE3DIR) ; find . -name \*.o -print` ; do \
  531.         cmp $(STAGE2DIR)/$$i $(STAGE3DIR)/$$i || touch .bad-compare ; \
  532.     done
  533. endif
  534.     if [ -f CLEAN_ALL ] ; then \
  535.       rm -rf $(STAGE2DIR) $(STAGE3DIR) ; \
  536.     else \
  537.       if [ -f CLEAN_STAGES ] ; then \
  538.         if [ -f .bad-compare ] ; then \
  539.           true ; \
  540.         else \
  541.           rm -rf $(STAGE1DIR) $(STAGE2DIR) ; \
  542.         fi ; \
  543.       else true ; \
  544.       fi ; \
  545.     fi
  546.     touch $@    
  547.  
  548. .PHONY: clean
  549. clean:
  550.     rm -rf $(HOLESDIR) $(INPLACEDIR) $(WORKING_DIR)* $(host)-stamp-* *~
  551.  
  552. .PHONY: very
  553. very:
  554.     rm -rf $(TREE)
  555.  
  556. force:
  557.  
  558. endif # host
  559.  
  560. ### Local Variables:
  561. ### fill-column: 131
  562. ### End:
  563.